package com.lance.shiro.mapper;

import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * Created By ShiYun with IntelliJ IDEA on 2018/12/11 17:35
 *
 * @author: ShiYun
 * @Email: 515867726@qq.com
 * @Date: 2018/12/11
 * To change this template use File | Settings | File Templates.
 */
public interface PropertyListTagsMapper {

    @Select("select * from i_property_list_tags where property_list_id=#{id}")
    List<Map> findByPropertyListId(int id);

    @Update("delete from i_property_list_tags where property_list_id=#{id}")
    void clear(int id);

//    @Insert("insert into i_property_list_tags (property_list_id,feature_id) values(#{propertyListId},#{featureId})")
//    @Options(useGeneratedKeys = true, keyProperty = "id")
//    int saveAdd(Map entity);

    @Update("<script>"
            + "insert into i_property_list_tags (property_list_id,feature_id) values"
            + "<foreach item='item' index='index' collection='ids' separator=','>"
            + "(#{propertyListId},#{item})"
            + "</foreach>"
            + "</script>")
    int addByIds(@Param("propertyListId") int propertyListId, @Param("ids") List<Integer> ids);
}
